#ifndef _FIG_BACKGROUND_ENEMY_H_
#define _FIG_BACKGROUND_ENEMY_H_

#include "fig_background.h"
#include "fig_life_obj.h"
#include "fig_bone_object.h"


class FIGBackgroundEnemy : public FIGBackground , public FIGLifeObj
{
public:


	enum LAUNCHER_STATE
	{
		LAUNCHER_STATE_NOT_SHOWNYET,
		LAUNCHER_STATE_FIRST_SHOWN,
		LAUNCHER_STATE_TRANSFORM,
		LAUNCHER_STATE_ATTACK,
		LAUNCHER_STATE_COUNT

	};

	enum	LAUNCHER_TYPE
	{
		
		LAUNCHER_TYPE_UNKNOWN,
		LAUNCHER_TYPE_2SHOOTS,
		LAUNCHER_TYPE_3SHOOTS,
		LAUNCHER_TYPE_6SHOOTS,
		LAUNCHER_TYPE_COUNT,
	};

	FIGBackgroundEnemy(const std::string& Name , 
						const math::Vec2&	Pos,
						float Speed, 
						float	MoveScaleX,
						float Rotation, 
						float Scale,
						int Layer
						);


	
	virtual void				Tick(float dt);	
	virtual void				Render(const math::Vec2& Offset,float Scale);
	virtual void				Clear();
    void						AimToPlayer(float dt);

	
	virtual bool				IsHitAble() { return true; };
	
	// provide some pure v-funcs of FIGLifeObj
	virtual const math::Vec2&	GetPos(){ return m_Pos; };
	virtual const math::Vec2&	GetSize() { return m_Size; };
	virtual float				GetRadius() { return 0; }
	virtual ui::UISprite*		GetSprite() { return &m_Sprite; };
	virtual float				GetRotation() { return m_Rotation; };
	


	static std::string			MapTypeToBoneFile(LAUNCHER_TYPE Type);
	static std::string			MapTypeToName(LAUNCHER_TYPE Type);
	static LAUNCHER_TYPE 		MapNameToType(const std::string& TypeName);


	virtual bool				HitTest(FIGBullet* pBullet);
	virtual bool				HitTest(const math::Vec2& Point);
	virtual void				GotDamage(float Amount,FIGBullet* pBullet,bool Force);

	std::string					GetBoneFileName()const;
	LAUNCHER_TYPE				GetLauncherType() const { return m_LaucherType; };	

protected:

	virtual void				OnShoot();
	virtual void				OnDie();

	math::Vec2					GetBonePos(int ID);
	void						GetForeGroundPos(math::Vec2& Output);

	void						Tick_States(float dt);
	void						Tick_NotShownYet(float dt);
	void						Tick_Transform(float dt);
	void						Tick_Attack(float dt);

	void						OnShoot_2();
	void						OnShoot_3();
	void						OnShoot_6();


	
    FIGBoneObject				m_Bone;
	LAUNCHER_STATE				m_State;
	LAUNCHER_TYPE				m_LaucherType;

	float						m_OringinalX;	  	
    bool						m_bShouldTakeLessDamage;

};

#endif